<template>
  <div style="background: #FE9A51;height: 100vh;">
    <c-title :hide="false" text="点位记录"></c-title>
    
    
    <div class="list_box">
      <!--  -->
      <div class="list" v-for="(item, index) in new_content" :key="index">
        <div class="list-top" >
          <div class="title">会员:{{ item.buyer_mobile }}</div>
          <div style="display: flex; justify-content: space-between;">
            <div class="amount">占用点位：{{ item.dw }}</div>
            <div class="amount">订单金额：{{ item.order_price }}</div>
          </div>
          <!-- <div class="button">下单</div> -->
        </div>
        <div class="list-botton">
          {{ item.create_date }}
        </div>
      </div>
    </div>

  </div>
</template>

<script>
import { scrollMixin } from "utils/mixin";
export default {
  mixins: [scrollMixin], //加载更多
  data() {
    return {
      new_content: [],
      //加载更多
      isLoadMore: false,
      total_page: 0,
      page: 1,
      
      userinfo:JSON.parse(localStorage.getItem('userinfo')),
      dwid:24,
    }
  },
  mounted() {
    this.dwid = this.$route.query.dwid;
    this.search()
    // this.getData();
    console.log(this.$route.query.dwid);
    
  },
  methods: {    
    getMoreData() {
      var that = this;
      this.isLoadMore = false;// 防止多次请求分页数据
      if (this.page >= this.total_page) {
        return;
      } else {
        this.page = this.page + 1;
        $http
          .get(
            "member.member-xj.qydwrecord",
            {page: this.page,dwid:this.dwid },
            "正在获取更多订单"
          )
          .then(
            function (response) {
              if (response.result == 1) {
                that.isLoadMore = true;
                that.new_content = that.new_content.concat(response.data.list.data);
              } else {
                that.page = that.page - 1;
                that.isLoadMore = false;
                return;
              }
            },
            function (response) {
              // error callback
            }
          );
      }
    },
    search() {
      let that = this;
      this.isLoadMore = true;
      this.page = 1;
      this.total_page = 0;
      let json = {
        "page": this.page,
        "current_page": this.page,
        "dwid":this.dwid
      };
      $http.post('member.member-xj.qydwrecord', json, "").then(function (response) {
        if (response.result === 1) {
          that.new_content = [];
          that.new_content = response.data.data;
          that.total_page = response.data.last_page;
          that.page = response.data.current_page;

        } else {
          console.log(response.msg);
        }
      }, function (response) {
        // error callback
      });
    },
  }
}
</script>

<style lang="scss" rel="stylesheet/scss" scoped>

.list_box{
  padding: 1rem 1rem;
  background: #FE9A51;
  .list {
    text-align: left;
    padding: .825rem 1rem ;
    border-radius: .825rem;
    background: #fff;
    margin-bottom: 10px;
    .list-top{
      position: relative;
      .title{
        // font-weight: bold;
        font-size: 1rem;
      }
      .amount{
        font-size: 1rem;
      }

      .button{
        border-radius: .825rem;
        background: #FE9A51;
        color: #fff;
        font-size: 1rem;
        position: absolute;
        right: 0;
        top: 0;
        padding: .125rem .325rem;
      }
    }
    .list-botton{
      margin-top: 5px;
      color: #999;
    }
  }
}


</style>